// 专门管理5个接口
const path = require("path")

const multer = require("multer")
// express 的路由管理对象
const upload = multer({ dest: path.join(__dirname, "../uploads") }) // dest指的是目标目录
const router = require("express").Router() // 得到一个路由对象
const {
  getList,
  deleteArticle,
  addArticle,
} = require("../router_handler/article")

router.get("/list", getList)

router.get("/delete/:id", deleteArticle)

router.post("/add", upload.single("cover_img"), addArticle) // upload.single()从表单数据中获取文件对象 => 存储到对应的一个目录下
module.exports = router // 导出这个对象
